package duotai;

/**
 * 农作物
 */
public  class AppleTree extends Crop{
    private String brand;//品种

    public AppleTree() {
//        super();// 调用了父类的无参构造器， 默认可以省略
        System.out.println("苹果树出生");
    }

    public AppleTree(String name,
                     int growTime,
                     int harvestTime,
                     int numsOfFruits,
                     String status,
                     boolean isHarvested,
                     String brand) {
        super(name,
                growTime,
                harvestTime,
                numsOfFruits,
                status,
                isHarvested);
        this.brand = brand;
    }

    public AppleTree(String brand) {
        super("");
        this.brand = brand;
    }



    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }


    /**
     * override:覆盖 方法重写
     *
     *  继承: 共同的内容放到父类,
     *  如果有不同的地方, 在子类重写
     *
     *  如果自己有就调用自己的, 没有就调用父类的
     *
     */
    @Override //可以省略
    public void print() {
        System.out.println("*****作物特性*****");
        System.out.println("您种植了" + this.getName() + "。");
        System.out.println("生长期" + this.getGrowTime() + "天，"
                + "采摘期" + this.getHarvestTime() + "天， "
                + "产量" + this.getNumsOfFruits() + ",现在处于" + this.getStatus() + ",是否可以采摘:" + this.isHarvested());
        System.out.println("品种:" + this.getBrand());

    }
}
